package com.reading_recognition_system.controller;

import com.reading_recognition_system.pojo.Test;
import com.reading_recognition_system.service.impl.TestServiceImpl;
import com.reading_recognition_system.util.Result;
import com.reading_recognition_system.util.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
/*
* 这是一个测试样例
* */
@Controller
@RequestMapping("/test")
public class TestController {
    @Autowired
    private TestServiceImpl test;
//    TestMapper test;

    @RequestMapping("/test1")
    @ResponseBody
    public Result<Test> test(int id) {
        Test res = test.getById(id);
        return new Result<Test>(StatusCode.SUCCESS,res,"成功");
    }

    @RequestMapping("/test2")
    @ResponseBody
    public Result<List<Test>> test2() {
        List<Test> res = test.getAll();
        return new Result<>(StatusCode.SUCCESS,res,"成功");
    }

}
